package com.jsgt.greekfire.ui.me

import android.os.Bundle
import android.view.View
import com.fhx.core.base.BaseFragment
import com.fhx.core.goToActivity
import com.fhx.core.utils.ToastUtils
import com.jsgt.greekfire.R
import com.jsgt.greekfire.ui.me.aboutus.AboutUsActivity
import com.jsgt.greekfire.ui.me.setting.SettingActivity
import com.jsgt.greekfire.ui.mine.user.address.AddressActivity
import com.jsgt.greekfire.ui.mine.user.messagelist.MessageListActivity
import com.jsgt.greekfire.ui.wallet.ManageActivity
import kotlinx.android.synthetic.main.fragment_me.*

private const val ARG_PARAM1 = "param1"
private const val ARG_PARAM2 = "param2"

class MeFragment : BaseFragment() ,View.OnClickListener{
    private var param1: String? = null
    private var param2: String? = null

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        arguments?.let {
            param1 = it.getString(ARG_PARAM1)
            param2 = it.getString(ARG_PARAM2)
        }
    }

    companion object {
        @JvmStatic
        fun newInstance(param1: String, param2: String) =
            MeFragment().apply {
                arguments = Bundle().apply {
                    putString(ARG_PARAM1, param1)
                    putString(ARG_PARAM2, param2)
                }
            }
    }

    override fun getLayoutId(): Int {
        return R.layout.fragment_me
    }

    override fun main() {
        imvMessage.setOnClickListener(this)
        itemAddress.setOnClickListener(this)
        itemWalletM.setOnClickListener(this)
        itemSetting.setOnClickListener(this)
        itemMeMenuAbout.setOnClickListener(this)
        itemTerms.setOnClickListener(this)
        itemSupport.setOnClickListener(this)
    }

    override fun onClick(v: View?) {
        when(v?.id){
            R.id.imvMessage -> {
                goToActivity<MessageListActivity>()
//                ToastUtils.show(R.string.not_yet_open)
            }
            R.id.itemAddress -> {
                goToActivity<AddressActivity>()
//                ToastUtils.show(R.string.not_yet_open)
            }
            R.id.itemWalletM -> {
                goToActivity<ManageActivity>()
            }
            R.id.itemSetting -> {
                goToActivity<SettingActivity>()
            }
            R.id.itemMeMenuAbout -> {
                goToActivity<AboutUsActivity>()
            }
            R.id.itemSupport -> {
                ToastUtils.show(R.string.not_yet_open)
            }
            R.id.itemTerms -> {
                ToastUtils.show(R.string.not_yet_open)
            }
        }
    }
}